package com.leyou.upload.configs;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import com.leyou.upload.properties.OSSProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther: xiang
 * @Date: 2019/8/17 14:52
 * @Description:
 */
@Configuration
@EnableConfigurationProperties(OSSProperties.class)
public class OSSConfig {
    @Bean
    public OSS ossClient(OSSProperties prop){
        return new OSSClientBuilder().build(prop.getEndpoint(),prop.getAccessKeyId(),prop.getAccessKeySecret());

    }



}